﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/AdminSite.Master" Inherits="System.Web.Mvc.ViewPage<HuynhQuangWebsite.Models.Admin>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">
<!-- Validation form -->
<%using (Html.BeginForm("Create", "ManageAdmin", FormMethod.Post, new { enctype = "multipart/form-data", @class = "form", id = "validate" }))
    {
       %>
    <fieldset>
        <div class="widget">
            <div class="title"><img src="../../Images/adminSite/icons/dark/pencil.png" alt="" class="titleIcon" /><h6>Thông tin quản trị viên</h6></div>
            <div class="formRow">
                <label>Tên đăng nhập:<span class="req">*</span></label>
                <div class="formRight"><%:Html.TextBoxFor(model => model.UserName, new { @class = "validate[required,custom[onlyLetterNumber]", id = "UserNameID" ,onblur="return CheckName()"})%>
                 <div id="dvUserName" style="visibility:collapse"> <span class="req"><label id="lbl"></label>: đã có người dùng</span></div>
                </div>
                
                <div class="clear"></div>
            </div>
            <div class="formRow">
                <label>Mật khẩu:<span class="req">*</span></label>
                <div class="formRight"><%:Html.PasswordFor(model => model.Password,new { @class = "validate[required,minSize[6]]", id = "reg" })%>
                 <%: Html.ValidationMessageFor(model => model.Password)%>
                </div>
                
                <div class="clear"></div>
            </div>
            <div class="formRow">
                <label>Nhập lại:<span class="req">*</span></label>
                 <div class="formRight"><%:Html.PasswordFor(model => model.ConfirmPassword, new { @class = "validate[required,equals[reg]]", id = "req" })%>
                 </div>
                <div class="clear"></div>
            </div>
             <div class="formRow">
                <label>Loai:<span class="req">*</span></label>
                <div class="formRight">   <%=Html.DropDownList("type", new[] { new SelectListItem { Text = "Quản trị viên", Value = "Consultant" }, new SelectListItem { Text = "Quản trị tối cáo", Value = "Admin", Selected = true } }, new { @class = "validate[required]", id = "req" })%>
               </div>
                <div class="clear"></div>
            </div>
        </div>
        <div class="widget">
            
            <div class="formSubmit"><input type="reset" value="Xóa" class="redB" /></div>
            <div class="formSubmit"><input type="submit" value="Lưu" class="blueB" /></div>
            <div class="clear"></div>
            <div><%:Html.HiddenFor(model => model.AdminID)%></div>
        </div>
             
    </fieldset>
    <%} %>

       <script type="text/javascript">

           function CheckName() {
               var name = $("#UserNameID").val();
               $.post("/ManageAdmin/CheckName/", { username: name },
	                    function (data) {
	                        if (data === "True") {
	                            $('#dvUserName').css("visibility", "collapse");
	                            return true;
	                        }
	                        else {
	                            $('#dvUserName').css("visibility", "visible");
	                            document.getElementById('lbl').innerHTML = name;
	                            $("#UserNameID").val("");
	                            return false;
	                        }
	                    });
           }
          

	    </script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="TitleAreaPlaceHolder" runat="server">
</asp:Content>
